<meta charset="utf-8">
<?php
include "/MyDb.php";
if($_POST['username'] != null && $_POST['passwd'] != null)
{
    $username = $_POST['username'];
    $passwd = MD5($_POST['passwd']);
    $sql = new PDO('mysql:host=localhost;dbname=lyon','lyon','lyon123');
    $reslut = $sql->query("select user_name from lyon_admin where password='$passwd'");
    $info = $reslut->fetch();
    if($info[user_name])
    {
        echo "<meta http-equiv='Refresh' content='0.5; url=/admin/templates/addtext.html' />";
    }
    else
    {
        echo "<script>alert('用户名或密码错误');history.go(-1);</script>";
    }
}
else
{
    echo "<script>alert('请输入用户名或密码');history.go(-1);</script>";
}

?>